Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

541
Visualizações
How to delete one request in react axios? [FIXED]

There is a list of notifications from the backend. Each notification has a delete button. If I click the delete button of any notification, I want that notification to be deleted.

How do I do this?

my service

const remove = (notificationDto) => {
  return new Observable((observer) => { //<NotificationDto>
    axiosInstance
      .delete(SERVICE_PATH + '/remove', notificationDto)
      .then((response) => {
        observer.next(response.data);
        observer.complete();
      })
      .catch((err) => {
        console.log(err);
      });
  });
};

html

<div className="notificationlist__container only-desktop">
  {props.notification.notificationList.map((notification) => {
    return (
      <div className="notificationlist__time">
        {notification.notificationDay}
        <div className="delete__button">
          <AS.IconButton onClick={() => notificationDataUpdateDeleteClick(notification)}>
            <AS.DeleteIcon />
          </AS.IconButton>
        </div>
      </div>
    );
  })}
</div>

where i call the service

After sending notification as payload, the problem was solved

import { InAppNotificationsService } from 'services/InAppNotificationsService';
import { NotificationContext } from 'contexts/NotificationContext';

const { notificationData, setNotificationData } = useContext(NotificationContext);

const notificationDataUpdateDeleteClick = (notification) => {
  InAppNotificationsService.remove({ data: notification }).subscribe({
    next: (response) => {
      InAppNotificationsService.allNotifications({ nationalId: tckn, externalContactNumber: contactInfo?.externalContactNumber }).subscribe({
        next: (response) => {
          setNotificationData(response);
        },
        error: (error) => {
          console.log(error);
        }
      });
    },
    error: (error) => {
      console.log(error);
    }
  });
};
about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda